package com.nf.controller;

import com.nf.vo.ResultDto;

import javax.servlet.http.HttpServlet;

public class BaseServlet extends HttpServlet {

    public ResultDto successJson(Object value){
        ResultDto dto=new ResultDto();
        dto.setValue(value);
        return dto;
    }

    public ResultDto successJson(){
        return new ResultDto();
    }

    public ResultDto errorJson(){
        ResultDto dto=new ResultDto();
        dto.setCode(500);
        dto.setMsg("系统繁忙，请稍后重试!");
        return dto;
    }

    public ResultDto errorJson(int code,String msg){
        ResultDto dto=new ResultDto();
        dto.setCode(code);
        dto.setMsg(msg);
        return dto;
    }

    public ResultDto errorJson(String msg){
        ResultDto dto=new ResultDto();
        dto.setCode(500);
        dto.setMsg(msg);
        return dto;
    }
}
